package com.easylinkin.linkappapi.lobar.timer;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.easylinkin.linkappapi.location.mapper.LinkappLocationDeviceMapper;
import com.easylinkin.linkappapi.safe.dao.InspectionPlanMapper;
import com.easylinkin.linkappapi.safe.entity.InspectionPlan;
import com.easylinkin.linkappapi.safe.service.InspectionTaskService;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.util.Date;
import java.util.List;

/**
 * @Author: kan yuanfeng
 * @Date: 2022/5/25 15:41
 * @Description: 人员定时任务
 */
@Component
public class LaborTimer {

  @Autowired
  private LinkappLocationDeviceMapper linkappLocationDeviceMapper;

  private static final Logger LOGGER = org.slf4j.LoggerFactory.getLogger(
      LaborTimer.class);

  @Scheduled(cron = "0 0,30 * * * ? ")
  public void deviceCheck(){
    //修改30分钟内未更新得设备为离线状态
    try {
      LOGGER.info("deviceCheck定时任务开始---------------deviceCheck------------start--");
      linkappLocationDeviceMapper.updateDeviceOnLineStatus();
      LOGGER.info("deviceCheck定时任务完成---------------deviceCheck------------end--");
    }catch (Exception e){
      LOGGER.info("deviceCheck定时任务异常---------------deviceCheck------------error--",e);
    }
  }
}
